package Test16;

public class Student extends Person {
    private String sid;

    @Override
    public String toString() {
        return "学号：" + sid + " 姓名：" + getName() + " 年龄：" + getAge();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Student student = (Student) o;

        return sid != null ? sid.equals(student.sid) : student.sid == null;

    }

    @Override
    public int hashCode() {
        return sid != null ? sid.hashCode() : 0;
    }

    public Student() {
    }

    public Student(String sid, String name, int age) {
        super(name, age);
        this.sid = sid;
    }

    public String getSid() {
        return sid;
    }

    public void setSid(String sid) {
        this.sid = sid;
    }

    @Override
    public void work() {

    }
}
